package com.ydkj.a37e_mall.Classes.Acitivity.Adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.ydkj.a37e_mall.Classes.Model.Response.GetProvinceResp;

import java.util.List;

/**
 * 用于找店中的popwindow(省份选择的适配器)
 */

public class PopProvinceAdapter extends BaseAdapter {

    private Context context;
    private List<GetProvinceResp.ResultEntity.DataEntity> province;
    private LayoutInflater mInflater;
    TextView textView = null;

    public PopProvinceAdapter(Context context, List<GetProvinceResp.ResultEntity.DataEntity> province) {
        this.context = context;
        this.province = province;
        mInflater = LayoutInflater.from(context);
    }

    public int getCount() {
        // TODO Auto-generated method stub
        return province.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return province.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            textView = new TextView(context);
        } else {
            textView = (TextView) convertView;
        }
        textView.setText(province.get(position).getName());
        textView.setTextSize(14);
        textView.setGravity(Gravity.CENTER);
        textView.setPadding(0, 40, 0, 40);
        textView.setTextColor(Color.BLACK);
        return textView;
    }


}
